<template>
  <div>
    News
    <h2>News</h2>
    <router-link tag="button" to="/home/news/newsdetail/乔丹/214000000"
      >篮球</router-link
    >
    <router-link
      tag="button"
      :to="{
        //path:'/home/news/money',//如果传递的是params对象，则不能传递path，只能使用name
        name: 'newsdetail',
        params: {
          name: '老李',
          price: 1000000000,
        },
      }"
      >财经</router-link
    >
    <router-link
      tag="button"
      :to="{
        name: 'newsdetail',
        params: {
          name: 'laowang',
          price: null, //可选的params参数不能书写空串,要么直接不写这个参数,要么书写一个null/home/news/study/老王/9999123
        },
      }"
      >学习</router-link
    >
    <router-view></router-view>
  </div>
</template>

<script>
  export default {
    name: "News",
    mounted() {
      console.log("News mounted", this.$route.meta);
    },
  };
</script>

<style></style>
